﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.master" AutoEventWireup="true" CodeBehind="ShopFront.aspx.cs" Inherits="UdrinkWater_Project.Officer.ShopFront" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
     <script type="text/javascript">
    // <![CDATA[
         function ShowSertEmpWindow() {
             pcDataEmp.Show();
         }
         function ShowSertCusWindow() {
             pcCusData.Show();
         }
         function ShowSertProWindow() {
             pcProduct.Show();
         }
    // ]]> 
    </script>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
     <dx:ASPxPopupControl ID="pcProduct" runat="server" CloseAction="CloseButton" Modal="True"
        PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter" ClientInstanceName="pcProduct"
        HeaderText="ค้นหาสินค้า" AllowDragging="True" PopupAnimationType="None" EnableViewState="False" Width="960px">
        <ClientSideEvents PopUp="function(s, e) { ASPxClientEdit.ClearGroup('entryGroup'); }" />
         <ContentCollection>
<dx:PopupControlContentControl runat="server" SupportsDisabledAttribute="True">
    <table style="width: 100%">
        <tr>
            <td>
                <asp:SqlDataSource ID="SqlProduct" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" 
                    
                    SelectCommand="SELECT TB_Product.Product_ID, TB_Product.Product_name, TB_Unit_Category.Unit_Name, TB_Product.Price, TB_Product.In_Stock, TB_Product.Image_Path FROM TB_Product LEFT JOIN TB_Unit_Category ON TB_Product.Unit = TB_Unit_Category.Unit_ID">
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" 
                    SelectCommand="SELECT ID_Card, Prefix + ' ' + Firstname + ' ' + Lastname AS Name, Adress, Zipcode, DISTRICT_ID, AMPHUR_ID, PROVINCE_ID FROM TB_Customer">
                </asp:SqlDataSource>
            </td>
        </tr>
        <tr>
            <td align="center">
                <dx:ASPxGridView ID="ASPxGridView4" runat="server" AutoGenerateColumns="False" 
                    DataSourceID="SqlProduct" KeyFieldName="Product_ID" Width="80%" 
                    OnRowCommand="ASPxGridView4_RowCommand">
                    <Columns>
                        <dx:GridViewDataTextColumn Caption="เลือก" ShowInCustomizationForm="True" 
                            VisibleIndex="7">
                            <DataItemTemplate>
                                <table style="width: 100%">
                                    <tr>
                                        <td align="center">
                                            <dx:ASPxButton ID="btSertProd" runat="server" Text="เลือก" CommandName="Cmd_Select"  CommandArgument='<%# Eval("Product_ID") %>'>
                                                <ClientSideEvents Click="function(s, e) {
	pcProduct.Hide();
}" />
                                            </dx:ASPxButton>
                                        </td>
                                    </tr>
                                </table>
                            </DataItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" />
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewCommandColumn ShowInCustomizationForm="True" VisibleIndex="0" 
                            Visible="False">
                            <ClearFilterButton Visible="True">
                            </ClearFilterButton>
                        </dx:GridViewCommandColumn>
                        <dx:GridViewDataTextColumn FieldName="Product_ID" ReadOnly="True" 
                            ShowInCustomizationForm="True" VisibleIndex="2" Caption="รหัสสินค้า">
                            <Settings AutoFilterCondition="Contains" FilterMode="DisplayText" />
                            <HeaderStyle HorizontalAlign="Center" />
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="Product_name" 
                            ShowInCustomizationForm="True" VisibleIndex="3" Caption="ชื่อสินค้า">
                            <Settings AutoFilterCondition="Contains" FilterMode="DisplayText" />
                            <HeaderStyle HorizontalAlign="Center" />
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="Unit_Name" ShowInCustomizationForm="True" 
                            VisibleIndex="4" Caption="หน่วย">
                            <Settings AutoFilterCondition="Contains" FilterMode="DisplayText" />
                            <HeaderStyle HorizontalAlign="Center" />
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="Price" ShowInCustomizationForm="True" 
                            VisibleIndex="5" Caption="ราคา/หน่วย">
                            <Settings AutoFilterCondition="Contains" FilterMode="DisplayText" />
                            <HeaderStyle HorizontalAlign="Center" />
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="In_Stock" ShowInCustomizationForm="True" 
                            VisibleIndex="6" Caption="จำนวนคงเหลือ" Visible="False">
                            <Settings AutoFilterCondition="Contains" FilterMode="DisplayText" />
                            <HeaderStyle HorizontalAlign="Center" />
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataBinaryImageColumn FieldName="Image_Path" 
                            ShowInCustomizationForm="True" VisibleIndex="1" Caption="รูปภาพ" 
                            Visible="False">
                            <HeaderStyle HorizontalAlign="Center" />
                        </dx:GridViewDataBinaryImageColumn>
                    </Columns>
                    <Settings ShowFilterRow="True" />
                </dx:ASPxGridView>
            </td>
        </tr>
    </table>
             </dx:PopupControlContentControl>
</ContentCollection>
     </dx:ASPxPopupControl>
     <dx:ASPxPopupControl ID="pcCusData" runat="server" CloseAction="CloseButton" Modal="True"
        PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter" ClientInstanceName="pcCusData"
        HeaderText="ค้นหาลูกค้า" AllowDragging="True" PopupAnimationType="None" EnableViewState="False" Width="960px">
        <ClientSideEvents PopUp="function(s, e) { ASPxClientEdit.ClearGroup('entryGroup'); }" />
         <ContentCollection>
<dx:PopupControlContentControl runat="server" SupportsDisabledAttribute="True">
    <table style="width: 100%">
        <tr>
            <td>
                <asp:SqlDataSource ID="SqlCusto" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" 
                    SelectCommand="SELECT TB_Customer.ID_Card, (TB_Customer.Prefix +' '+ TB_Customer.Firstname +' '+ TB_Customer.Lastname) AS Name, TB_Customer.Adress, TB_District.DISTRICT_NAME, TB_Aumphur.AMPHUR_NAME, TB_Province.PROVINCE_NAME, TB_Customer.Zipcode, TB_Customer.Phone FROM TB_Customer LEFT OUTER JOIN TB_Aumphur ON TB_Customer.AMPHUR_ID = TB_Aumphur.AMPHUR_ID LEFT OUTER JOIN TB_District ON TB_Customer.DISTRICT_ID = TB_District.DISTRICT_ID LEFT OUTER JOIN TB_Province ON TB_Customer.PROVINCE_ID = TB_Province.PROVINCE_ID">
                </asp:SqlDataSource>
            </td>
        </tr>
        <tr>
            <td align="center">
                <dx:ASPxGridView ID="ASPxGridView3" runat="server" AutoGenerateColumns="False" 
                    DataSourceID="SqlCusto" KeyFieldName="ID_Card" Width="80%" 
                    OnRowCommand="ASPxGridView3_RowCommand">
                    <Columns>
                        <dx:GridViewCommandColumn ShowInCustomizationForm="True" Visible="False" 
                            VisibleIndex="0">
                            <ClearFilterButton Visible="True">
                            </ClearFilterButton>
                        </dx:GridViewCommandColumn>
                        <dx:GridViewDataTextColumn Caption="เลือก" ShowInCustomizationForm="True" 
                            VisibleIndex="9">
                            <DataItemTemplate>
                                <table style="width: 100%">
                                    <tr>
                                        <td align="center">
                                            <dx:ASPxButton ID="btCusChoose" runat="server" Text="เลือก" 
                                                CommandName="Cmd_Select"  CommandArgument='<%# Eval("ID_Card") %>'>
                                                <ClientSideEvents Click="function(s, e) {
	pcCusData.Hide();
}" />
                                            </dx:ASPxButton>
                                        </td>
                                    </tr>
                                </table>
                            </DataItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" />
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="ID_Card" ReadOnly="True" 
                            ShowInCustomizationForm="True" VisibleIndex="1" Width="150px" 
                            Caption="ค้นหารหัสลูกค้า">
                            <Settings AutoFilterCondition="Contains" FilterMode="DisplayText" />
                            <HeaderStyle HorizontalAlign="Center" />
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="Name" ReadOnly="True" 
                            ShowInCustomizationForm="True" VisibleIndex="2" Caption="ค้นหาชื่อนามสกุล">
                            <Settings AutoFilterCondition="Contains" FilterMode="DisplayText" />
                            <HeaderStyle HorizontalAlign="Center" />
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="Adress" ShowInCustomizationForm="True" 
                            Visible="False" VisibleIndex="3">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="DISTRICT_NAME" 
                            ShowInCustomizationForm="True" Visible="False" VisibleIndex="4">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="AMPHUR_NAME" 
                            ShowInCustomizationForm="True" Visible="False" VisibleIndex="5">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="PROVINCE_NAME" 
                            ShowInCustomizationForm="True" Visible="False" VisibleIndex="6">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="Zipcode" ShowInCustomizationForm="True" 
                            Visible="False" VisibleIndex="7">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="Phone" ShowInCustomizationForm="True" 
                            VisibleIndex="8" Caption="ค้นหาเบอร์โทรศัพท์">
                            <Settings AutoFilterCondition="Contains" FilterMode="DisplayText" />
                            <HeaderStyle HorizontalAlign="Center" />
                        </dx:GridViewDataTextColumn>
                    </Columns>
                    <Settings ShowFilterRow="True" />
                </dx:ASPxGridView>
            </td>
        </tr>
    </table>
             </dx:PopupControlContentControl>
</ContentCollection>
     </dx:ASPxPopupControl>
     <dx:ASPxPopupControl ID="pcDataEmp" runat="server" CloseAction="CloseButton" Modal="True"
        PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter" ClientInstanceName="pcDataEmp"
        HeaderText="ค้นหาพนักงาน" AllowDragging="True" PopupAnimationType="None" 
         EnableViewState="False" Width="960px">
        <ClientSideEvents PopUp="function(s, e) { ASPxClientEdit.ClearGroup('entryGroup'); tbLogin.Focus(); }" />
<ContentCollection>
<dx:PopupControlContentControl runat="server" SupportsDisabledAttribute="True">
    <table style="width: 100%">
        <tr>
            <td>
                <asp:SqlDataSource ID="SqlEmp" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" 
                    SelectCommand="SELECT ID_Card,( Prefix + '' + Firstname + ' ' + Lastname ) AS Name FROM TB_Employee">
                </asp:SqlDataSource>
            </td>
        </tr>
        <tr>
            <td align="center">
                <dx:ASPxGridView ID="ASPxGridView2" runat="server" AutoGenerateColumns="False" 
                    DataSourceID="SqlEmp" KeyFieldName="ID_Card" Width="80%" 
                    OnRowCommand="ASPxGridView2_RowCommand">
                    <Columns>
                        <dx:GridViewCommandColumn ShowInCustomizationForm="True" Visible="False" 
                            VisibleIndex="0">
                            <ClearFilterButton Text="ยกเลิก" Visible="True">
                            </ClearFilterButton>
                        </dx:GridViewCommandColumn>
                        <dx:GridViewDataTextColumn 
                            ShowInCustomizationForm="True" VisibleIndex="3" Caption="เลือก">
                            <DataItemTemplate>
                                <table style="width: 100%">
                                    <tr>
                                        <td align="center">
                                            <dx:ASPxButton ID="btEmpChose" runat="server" Text="เลือก" CommandName="Cmd_Select"  CommandArgument='<%#Eval("ID_Card")%>'>
                                                <ClientSideEvents Click="function(s, e) {
	pcDataEmp.Hide();
}" />
                                            </dx:ASPxButton>
                                        </td>
                                    </tr>
                                </table>
                            </DataItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" />
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="ID_Card" ReadOnly="True" 
                            ShowInCustomizationForm="True" VisibleIndex="1" 
                            Caption="ค้นหาจากรหัสพนักงาน" Width="250px">
                            <Settings AutoFilterCondition="Contains" FilterMode="DisplayText" />
                            <HeaderStyle HorizontalAlign="Center" />
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="Name" ReadOnly="True" 
                            ShowInCustomizationForm="True" VisibleIndex="2" Caption="ค้นหาจากชื่อ" 
                            Width="250px">
                            <Settings AutoFilterCondition="Contains" FilterMode="DisplayText" />
                            <HeaderStyle HorizontalAlign="Center" />
                        </dx:GridViewDataTextColumn>
                    </Columns>
                    <Settings ShowFilterRow="True" />
                </dx:ASPxGridView>
            </td>
        </tr>
    </table>
    </dx:PopupControlContentControl>
</ContentCollection>
     </dx:ASPxPopupControl>
    <dx:ASPxRoundPanel ID="ASPxRoundPanel1" runat="server" HeaderText="หน้าร้าน" 
        Width="1080px">
        <HeaderStyle Font-Size="Large" />
        <PanelCollection>
            <dx:PanelContent runat="server" SupportsDisabledAttribute="True">
                <table style="width: 100%">
                    <tr>
                        <td valign="top" style="height: inherit" colspan="4">
                             <asp:Panel ID="Panel2" runat="server">
                                <fieldset><legend>วันที่เวลา</legend>
                                <asp:UpdatePanel ID="updDateOrder" runat="server">
                                    <ContentTemplate>
                                        <table style="width: 100%">
                                            <tr>
                                                <td style="width: 78px">
                                                    <dx:ASPxLabel ID="ASPxLabel3" runat="server" Text="วันเวลาเอกสาร:">
                                                    </dx:ASPxLabel>
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtOrderDate" runat="server" Width="225px" ReadOnly="True" 
                                                        BackColor="#D3E4A6">
                                                    </dx:ASPxTextBox>
                                                </td>
                                                <td>
                                                    &nbsp;</td>
                                            </tr>
                                        </table>
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </fieldset>
                                 <asp:Panel ID="Panel1" runat="server">
                                     <fieldset>
                                         <legend>พนักงาน</legend>
                                         <asp:UpdatePanel ID="udpEmp" runat="server">
                                             <ContentTemplate>
                                                 <table style="width: 100%">
                                                     <tr>
                                                         <td width="78">
                                                             <dx:ASPxLabel ID="ASPxLabel1" runat="server" Text="รหัสพนักงาน:">
                                                             </dx:ASPxLabel>
                                                         </td>
                                                         <td style="width: 244px">
                                                             <dx:ASPxTextBox ID="txtEmpID" runat="server" Width="225px">
                                                             </dx:ASPxTextBox>
                                                         </td>
                                                         <td style="width: 11px">
                                                             <dx:ASPxButton ID="btEmpSert" runat="server" Text="ค้นหา" Width="60px" 
                                                                 onclick="btEmpSert_Click" AutoPostBack="False" Height="23px">
                                                                 <ClientSideEvents Click="function(s, e) {
	 ShowSertEmpWindow();
}" />
                                                             </dx:ASPxButton>
                                                         </td>
                                                     </tr>
                                                     <tr>
                                                         <td>
                                                             <dx:ASPxLabel ID="ASPxLabel2" runat="server" Text="ชื่อพนักงาน:">
                                                             </dx:ASPxLabel>
                                                         </td>
                                                         <td style="width: 244px">
                                                             <dx:ASPxTextBox ID="txtEmpName" runat="server" Width="225px">
                                                             </dx:ASPxTextBox>
                                                         </td>
                                                         <td>
                                                             &nbsp;</td>
                                                     </tr>
                                                     <tr>
                                                         <td>
                                                             &nbsp;</td>
                                                         <td style="width: 244px">
                                                             &nbsp;</td>
                                                         <td>
                                                             &nbsp;</td>
                                                     </tr>
                                                 </table>
                                             </ContentTemplate>
                                         </asp:UpdatePanel>
                                     </fieldset>
                                     <asp:Panel ID="Panel3" runat="server">
                                         <fieldset>
                                             <legend>ลูกค้า</legend>
                                             <asp:UpdatePanel ID="updCustomer" runat="server">
                                                 <ContentTemplate>
                                                     <table style="width: 100%">
                                                         <tr>
                                                             <td width="78">
                                                                 <dx:ASPxLabel ID="ASPxLabel4" runat="server" Text="รหัสลูกค้า:">
                                                                 </dx:ASPxLabel>
                                                             </td>
                                                             <td style="width: 244px">
                                                                 <dx:ASPxTextBox ID="txtCustomerID" runat="server" Width="225px">
                                                                 </dx:ASPxTextBox>
                                                             </td>
                                                             <td>
                                                                 <dx:ASPxButton ID="btCustomerSert" runat="server" Text="ค้นหา" Width="60px" 
                                                                     onclick="btCustomerSert_Click" AutoPostBack="False">
                                                                     <ClientSideEvents Click="function(s, e) {
	 ShowSertCusWindow();
}" />
                                                                 </dx:ASPxButton>
                                                             </td>
                                                         </tr>
                                                         <tr>
                                                             <td>
                                                                 <dx:ASPxLabel ID="ASPxLabel5" runat="server" Text="ชื่อนามสกุล:">
                                                                 </dx:ASPxLabel>
                                                             </td>
                                                             <td style="width: 244px">
                                                                 <dx:ASPxTextBox ID="txtCusName" runat="server" Width="225px">
                                                                 </dx:ASPxTextBox>
                                                             </td>
                                                             <td>
                                                                 &nbsp;</td>
                                                         </tr>
                                                         <tr>
                                                             <td>
                                                                 <dx:ASPxLabel ID="ASPxLabel6" runat="server" Text="ที่อยู่:">
                                                                 </dx:ASPxLabel>
                                                             </td>
                                                             <td style="width: 244px">
                                                                 <dx:ASPxTextBox ID="txtCusAddress" runat="server" Width="225px">
                                                                 </dx:ASPxTextBox>
                                                             </td>
                                                         </tr>
                                                         <tr>
                                                             <td>
                                                                 <dx:ASPxLabel ID="ASPxLabel23" runat="server" Text="จังหวัด:">
                                                                 </dx:ASPxLabel>
                                                             </td>
                                                             <td style="width: 244px">
                                                                 <dx:ASPxComboBox ID="ASPxComboBox1" runat="server" ValueType="System.Int32" 
                                                                     AutoPostBack="True" DataSourceID="SqlProvince" 
                                                                     onselectedindexchanged="ASPxComboBox1_SelectedIndexChanged" 
                                                                     TextField="PROVINCE_NAME" ValueField="PROVINCE_ID" Width="225px">
                                                                 </dx:ASPxComboBox>
                                                                 <asp:SqlDataSource ID="SqlProvince" runat="server" 
                                                                     ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" 
                                                                     SelectCommand="SELECT * FROM [TB_Province] ORDER BY [PROVINCE_NAME]">
                                                                 </asp:SqlDataSource>
                                                             </td>
                                                         </tr>
                                                         <tr>
                                                             <td>
                                                                 <dx:ASPxLabel ID="ASPxLabel24" runat="server" Text="อำเภอ:">
                                                                 </dx:ASPxLabel>
                                                             </td>
                                                             <td style="width: 244px">
                                                                 <dx:ASPxComboBox ID="ASPxComboBox2" runat="server" ValueType="System.Int32" 
                                                                     AutoPostBack="True" DataSourceID="SqlAmphur" 
                                                                     onselectedindexchanged="ASPxComboBox2_SelectedIndexChanged" 
                                                                     TextField="AMPHUR_NAME" ValueField="AMPHUR_ID" Width="225px">
                                                                 </dx:ASPxComboBox>
                                                                 <asp:SqlDataSource ID="SqlAmphur" runat="server" 
                                                                     ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" 
                                                                     SelectCommand="SELECT * FROM [TB_Aumphur] WHERE ([PROVINCE_ID] = @PROVINCE_ID) ORDER BY [AMPHUR_NAME]">
                                                                     <SelectParameters>
                                                                         <asp:ControlParameter ControlID="ASPxComboBox1" Name="PROVINCE_ID" 
                                                                             PropertyName="Value" />
                                                                     </SelectParameters>
                                                                 </asp:SqlDataSource>
                                                             </td>
                                                         </tr>
                                                         <tr>
                                                             <td>
                                                                 <dx:ASPxLabel ID="ASPxLabel25" runat="server" Text="ตำบล:">
                                                                 </dx:ASPxLabel>
                                                             </td>
                                                             <td style="width: 244px">
                                                                 <dx:ASPxComboBox ID="ASPxComboBox3" runat="server" ValueType="System.Int32" 
                                                                     AutoPostBack="True" DataSourceID="SqlDistric" TextField="DISTRICT_NAME" 
                                                                     ValueField="DISTRICT_ID" Width="225px">
                                                                 </dx:ASPxComboBox>
                                                                 <asp:SqlDataSource ID="SqlDistric" runat="server" 
                                                                     ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" 
                                                                     SelectCommand="SELECT * FROM [TB_District] WHERE ([AMPHUR_ID] = @AMPHUR_ID) ORDER BY [DISTRICT_NAME]">
                                                                     <SelectParameters>
                                                                         <asp:ControlParameter ControlID="ASPxComboBox2" Name="AMPHUR_ID" 
                                                                             PropertyName="Value" />
                                                                     </SelectParameters>
                                                                 </asp:SqlDataSource>
                                                             </td>
                                                         </tr>
                                                         <tr>
                                                             <td>
                                                                 <dx:ASPxLabel ID="ASPxLabel26" runat="server" Text="รหัสไปรษณีย์:">
                                                                 </dx:ASPxLabel>
                                                             </td>
                                                             <td style="width: 244px">
                                                                 <dx:ASPxTextBox ID="ASPxTextBox2" runat="server" Width="225px">
                                                                 </dx:ASPxTextBox>
                                                             </td>
                                                         </tr>
                                                     </table>
                                                 </ContentTemplate>
                                             </asp:UpdatePanel>
                                         </fieldset>
                                     </asp:Panel>
                                 </asp:Panel>
                            </asp:Panel>
                        </td>
                        <td width="40%" valign="top" style="height: inherit" colspan="2">
                            <asp:Panel ID="Panel4" runat="server" Height="100%">
                                <fieldset>
                                    <legend>เพิ่มสินค้าในรายการ</legend>
                                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                                        <ContentTemplate>
                                            <table style="width: 100%">
                                                <tr>
                                                    <td style="width: 78px">
                                                        <dx:ASPxLabel ID="ASPxLabel7" runat="server" Text="รหัสสินค้า:">
                                                        </dx:ASPxLabel>
                                                    </td>
                                                    <td>
                                                        <dx:ASPxTextBox ID="txtProductId" runat="server" Width="225px" ReadOnly="True" 
                                                            BackColor="#D3E4A6">
                                                        </dx:ASPxTextBox>
                                                    </td>
                                                    <td>
                                                        <dx:ASPxButton ID="btProductSert" runat="server" Text="ค้นหา" Width="60px" 
                                                            AutoPostBack="False">
                                                            <ClientSideEvents Click="function(s, e) {
	ShowSertProWindow();
}" />
                                                        </dx:ASPxButton>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="width: 78px">
                                                        <dx:ASPxLabel ID="ASPxLabel8" runat="server" Text="ชื่อสินค้า:">
                                                        </dx:ASPxLabel>
                                                    </td>
                                                    <td>
                                                        <dx:ASPxTextBox ID="txtProductName" runat="server" Width="225px" 
                                                            ReadOnly="True" BackColor="#D3E4A6">
                                                        </dx:ASPxTextBox>
                                                    </td>
                                                    <td>
                                                        &nbsp;</td>
                                                </tr>
                                                <tr>
                                                    <td style="width: 78px">
                                                        <dx:ASPxLabel ID="ASPxLabel10" runat="server" Text="จำนวนคงเหลือ:">
                                                        </dx:ASPxLabel>
                                                    </td>
                                                    <td>
                                                        <dx:ASPxTextBox ID="txtInStock" runat="server" Width="225px" ReadOnly="True" 
                                                            BackColor="#D3E4A6">
                                                        </dx:ASPxTextBox>
                                                    </td>
                                                    <td rowspan="6">
                                                        <dx:ASPxImage ID="ASPxImage1" runat="server" Height="70px" Width="70px">
                                                        </dx:ASPxImage>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="width: 78px">
                                                        <dx:ASPxLabel ID="ASPxLabel12" runat="server" Text="หน่วยสินค้า:">
                                                        </dx:ASPxLabel>
                                                    </td>
                                                    <td>
                                                        <dx:ASPxTextBox ID="txtUnit" runat="server" Width="225px" ReadOnly="True" 
                                                            BackColor="#D3E4A6">
                                                        </dx:ASPxTextBox>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="height: 23px; width: 78px;">
                                                        <dx:ASPxLabel ID="ASPxLabel9" runat="server" Text="ราคา/หน่วย:">
                                                        </dx:ASPxLabel>
                                                    </td>
                                                    <td style="height: 23px">
                                                        <dx:ASPxTextBox ID="txtUnitPrice" runat="server" Width="225px" ReadOnly="True" 
                                                            BackColor="#D3E4A6">
                                                        </dx:ASPxTextBox>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="width: 78px">
                                                        <dx:ASPxLabel ID="ASPxLabel11" runat="server" Text="จำนวนซื้อ:">
                                                        </dx:ASPxLabel>
                                                    </td>
                                                    <td>
                                                        <dx:ASPxTextBox ID="txtCount" runat="server" style="margin-bottom: 0px" 
                                                            Width="225px" ClientInstanceName="txtCount">
                                                        </dx:ASPxTextBox>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="width: 78px">
                                                        <dx:ASPxLabel ID="ASPxLabel14" runat="server" Text="ส่วนลด:">
                                                        </dx:ASPxLabel>
                                                    </td>
                                                    <td>
                                                        <dx:ASPxTextBox ID="txtDiscount" runat="server" Width="225px">
                                                        </dx:ASPxTextBox>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="width: 78px">
                                                        &nbsp;</td>
                                                    <td>
                                                        &nbsp;</td>
                                                </tr>
                                                <tr>
                                                    <td style="width: 78px">
                                                        &nbsp;</td>
                                                    <td align="center">
                                                        <dx:ASPxLabel ID="lbWranList" runat="server" ForeColor="Red" 
                                                            Text="สินค้ามีในรายการแล้ว!" Visible="False">
                                                        </dx:ASPxLabel>
                                                    </td>
                                                    <td>
                                                        &nbsp;</td>
                                                </tr>
                                            </table>
                                        </ContentTemplate>
                                    </asp:UpdatePanel>
                               
                                <table style="width: 100%">
                                    <tr>
                                        <td align="center" style="height: 27px">
                                            &nbsp;</td>
                                    </tr>
                                    <tr>
                                        <td align="center" style="height: 27px">
                                            <dx:ASPxButton ID="btAddList" runat="server" OnClick="btAddList_Click" 
                                                Text="เพิ่มรายการ">
                                            </dx:ASPxButton>
                                        </td>
                                    </tr>
                                </table> 
                                </fieldset>
                            </asp:Panel>
                        </td>
                        <td width="20%" valign="top" style="height: inherit">
                            <asp:Panel ID="Panel5" runat="server">
                                <table style="width: 100%">
                                    <tr>
                                        <td align="left">
                                            <dx:ASPxLabel ID="ASPxLabel15" runat="server" Text="รวมเงิน:">
                                            </dx:ASPxLabel>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="left">
                                            <dx:ASPxTextBox ID="txtTotal" runat="server" Text="0.00" Width="190px" 
                                                BackColor="#D3E4A6">
                                                <DisabledStyle Font-Size="Large">
                                                </DisabledStyle>
                                            </dx:ASPxTextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="left">
                                            <dx:ASPxLabel ID="ASPxLabel16" runat="server" Text="รับเงิน:">
                                            </dx:ASPxLabel>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="left">
                                            <dx:ASPxTextBox ID="txtgetMoney" runat="server" Width="190px" 
                                                 Text="0.00">
                                            </dx:ASPxTextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center">
                                            <dx:ASPxButton ID="ASPxButton1" runat="server" OnClick="ASPxButton1_Click" 
                                                Text="คำนวณ">
                                            </dx:ASPxButton>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="left">
                                            <dx:ASPxLabel ID="ASPxLabel17" runat="server" Text="เงินทอน:">
                                            </dx:ASPxLabel>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="left">
                                            <dx:ASPxTextBox ID="txtCASH" runat="server" BackColor="#D3E4A6" Text="0.00" 
                                                Width="190px">
                                            </dx:ASPxTextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="left">
                                            &nbsp;</td>
                                    </tr>
                                    <tr>
                                        <td align="center">
                                            <dx:ASPxRadioButton ID="rbtStsatusUnpaid" runat="server" Text="ชำระแล้ว">
                                            </dx:ASPxRadioButton>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center">
                                            <dx:ASPxButton ID="btSaveAndReport" runat="server" Height="50px" 
                                                Text="บันทึกและพิมพ์ใบเสร็จ" Width="180px" OnClick="btSaveAndReport_Click">
                                            </dx:ASPxButton>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center">
                                            <dx:ASPxButton ID="btNewOrder" runat="server" Height="50px" 
                                                Text="เริ่มรายการใหม่" Width="180px" OnClick="btNewOrder_Click">
                                            </dx:ASPxButton>
                                        </td>
                                    </tr>
                                </table>
                            </asp:Panel>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="7">
                            <asp:Panel ID="Panel6" runat="server">
                                <fieldset>
                                    <legend>รายการสินค้า</legend>
                                    <dx:ASPxGridView ID="GV_OrderList" runat="server" Width="100%" 
                                        AutoGenerateColumns="False" Font-Size="Medium" KeyFieldName="Number" 
                                        OnCustomUnboundColumnData="GV_OrderList_CustomUnboundColumnData" 
                                        OnFocusedRowChanged="GV_OrderList_FocusedRowChanged" 
                                        OnRowCommand="GV_OrderList_RowCommand" 
                                        OnSummaryDisplayText="GV_OrderList_SummaryDisplayText">
                                        <TotalSummary>
                                            <dx:ASPxSummaryItem DisplayFormat="รวม {0:#,###.00}" FieldName="TotalRow" 
                                                SummaryType="Sum" />
                                        </TotalSummary>
                                        <Columns>
                                            <dx:GridViewDataTextColumn Caption="รหัสสินค้า" FieldName="Product_ID" 
                                                ShowInCustomizationForm="True" VisibleIndex="1">
                                                <HeaderStyle HorizontalAlign="Center" />
                                                <CellStyle HorizontalAlign="Center">
                                                </CellStyle>
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn Caption="ชื่อสินค้า" FieldName="Product_Name" 
                                                ShowInCustomizationForm="True" VisibleIndex="2">
                                                <HeaderStyle HorizontalAlign="Center" />
                                                <CellStyle HorizontalAlign="Center">
                                                </CellStyle>
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn Caption="หน่วย" FieldName="Unit" 
                                                ShowInCustomizationForm="True" VisibleIndex="3">
                                                <HeaderStyle HorizontalAlign="Center" />
                                                <CellStyle HorizontalAlign="Center">
                                                </CellStyle>
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn Caption="จำนวน" FieldName="Count" 
                                                ShowInCustomizationForm="True" VisibleIndex="5">
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn Caption="ราคา/หน่วย" FieldName="UnitPrice" 
                                                ShowInCustomizationForm="True" VisibleIndex="4">
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn Caption="รายการ" FieldName="Number" 
                                                ShowInCustomizationForm="True" UnboundType="String" VisibleIndex="0">
                                                <HeaderStyle HorizontalAlign="Center" />
                                                <CellStyle HorizontalAlign="Center">
                                                </CellStyle>
                                                <DataItemTemplate>
                                                    <%#Container.ItemIndex +1 %>
                                                </DataItemTemplate>
                                                <HeaderStyle HorizontalAlign="Center" />
                                                <CellStyle HorizontalAlign="Center">
                                                </CellStyle>
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn Caption="รวม" FieldName="TotalRow" 
                                                ShowInCustomizationForm="True" UnboundType="Decimal" VisibleIndex="7">
                                                <HeaderStyle HorizontalAlign="Center" />
                                                <CellStyle HorizontalAlign="Right">
                                                </CellStyle>
                                                <FooterCellStyle ForeColor="Black" HorizontalAlign="Right">
                                                </FooterCellStyle>
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn Caption="ส่วนลด" FieldName="Discount" 
                                                ShowInCustomizationForm="True" VisibleIndex="6">
                                                <HeaderStyle HorizontalAlign="Center" />
                                                <CellStyle HorizontalAlign="Center">
                                                </CellStyle>
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn Caption="ลบ" ShowInCustomizationForm="True" 
                                                VisibleIndex="8">
                                                <DataItemTemplate>
                                                    <dx:ASPxButton ID="btnImageAndText" runat="server" BackColor="White" 
                                                        CommandArgument="<%# Container.ItemIndex %>" CommandName="Cmd_Delete" 
                                                        Text="ลบรายการ" Width="120px">
                                                        <Image Height="16px" Url="../images/Remove.png" Width="16px">
                                                        </Image>
                                                        <ClientSideEvents Click="function(s,e) { e.processOnServer = confirm('Are you sure?'); }" />
                                                    </dx:ASPxButton>
                                                </DataItemTemplate>
                                                <HeaderStyle HorizontalAlign="Center" />
                                                <CellStyle HorizontalAlign="Center">
                                                </CellStyle>
                                            </dx:GridViewDataTextColumn>
                                        </Columns>
                                        <SettingsBehavior ConfirmDelete="True" />
                                        <Settings ShowFooter="True" ShowGroupFooter="VisibleIfExpanded" />
                                        <SettingsText ConfirmDelete="ยืนยันการลบข้อมูล" />
                                    </dx:ASPxGridView>
                                </fieldset>&nbsp;</asp:Panel>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <dx:ASPxLabel ID="ASPxLabel19" runat="server" Text="จำนวนการขายประจำวัน">
                            </dx:ASPxLabel>
                        </td>
                        <td align="center">
                            <dx:ASPxTextBox ID="txtListOrder" runat="server" Width="170px" 
                                BackColor="#D3E4A6" ReadOnly="True">
                            </dx:ASPxTextBox>
                        </td>
                        <td>
                            <dx:ASPxLabel ID="ASPxLabel20" runat="server" Text="รายการ">
                            </dx:ASPxLabel>
                        </td>
                        <td>
                            &nbsp;</td>
                        <td align="right">
                            <dx:ASPxLabel ID="ASPxLabel21" runat="server" Text="ยอดขายประจำวัน">
                            </dx:ASPxLabel>
                        </td>
                        <td align="center">
                            <dx:ASPxTextBox ID="ASPxTextBox1" runat="server" Width="170px" 
                                BackColor="#D3E4A6" ReadOnly="True">
                            </dx:ASPxTextBox>
                        </td>
                        <td>
                            <dx:ASPxLabel ID="ASPxLabel22" runat="server" Text="บาท">
                            </dx:ASPxLabel>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="7">
                            &nbsp;</td>
                    </tr>
                </table>
            </dx:PanelContent>
        </PanelCollection>
    </dx:ASPxRoundPanel>
</asp:Content>
